package com.ruoyi.business.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.business.domain.dto.admin.koc.TbUserKocPointsLogPageQueryDTO;
import com.ruoyi.business.domain.vo.TbUserKocPointsLogPageVO;
import com.ruoyi.business.domain.vo.TraceabilityDetailVO;
import com.ruoyi.business.service.koc.ITbUserKocPointsLogService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * koc 任务列表
 *
 * @author chenran
 */
@Validated
@Api(value = "koc用户积分获取流水", tags = {"koc用户积分获取流水"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/business/user/koc/points/log")
public class TbUserKocPointsLogController extends BaseController {

    @Resource
    private ITbUserKocPointsLogService tbUserKocPointsLogService;

    @ApiOperation("koc用户积分获取流水")
    @SaCheckPermission("business:koc:points:log:page")
    @GetMapping("/list")
    public TableDataInfo<TbUserKocPointsLogPageVO> list(TbUserKocPointsLogPageQueryDTO tbUserKocPointsLogPageQueryDTO, PageQuery pageQuery) {
        return tbUserKocPointsLogService.selectPageList(tbUserKocPointsLogPageQueryDTO, pageQuery);
    }


    @ApiOperation("根据sourceId溯源审核详情")
    @SaCheckPermission("business:koc:product:log:detail")
    @GetMapping("/{sourceId}")
    public R<TraceabilityDetailVO> getInfo(@ApiParam("审核主键id")
                                                  @NotNull(message = "审核主键id不能为空")
                                                  @PathVariable("sourceId") Long sourceId) {
        return R.ok(tbUserKocPointsLogService.selectDetail(sourceId));
    }



}
